﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.Linq;
using System.Linq;
using System.Text;

namespace DataAccessLayer
{
    public class DAL : DataContext
    {
        /// <summary>
        /// Ekki threadsafe singleton!
        /// Dugar þó fyrir það sem gera þarf.
        /// </summary>
        private static DAL dal;
        public static DAL GetDataContext
        {
            get
            {
                if (dal == null)
                {
                    dal = new DAL();
                }
                return dal;
            }
        }

        // Einfalt! Sjáið samt merkingarnar (attributes) 
        // í viðkomandi klösum (StudentToClass, o.s.fv í classes.cs) 
        public Table<StudentToClass> StudentsToClasses;
        public Table<TeacherToClass> TeachersToClasses;
        public Table<Student> Students;
        public Table<Teacher> Teachers;
        public Table<Class> Classes;
        
        public DAL() : base(@"Data Source=localhost;Initial Catalog=Example;Integrated Security=True;Pooling=True")
        {
        }
    }
}
